#include <iostream>
using std::cout;
using std::endl;
using std::cin;

int calc_sum1(const int *array, const int size)
{
	int sum = 0;
	for(int i = 0; i != size; i++)
	{
		sum += array[i];
	}
	
	return sum;
}

int calc_sum2(const int* beg, const int* end)
{
	int sum = 0;
	while(beg != end)
	{
		sum += *beg++;
	}

	return sum;
}

int calc_sum3(const int (&array)[10])
{
	int sum = 0;
	for(int i = 0; i != 10; i++)
	{
		sum += array[i];
	}
	
	return sum;
}

int main()
{
	const int size = 10;
	int array[size];
	for(int i = 0; i != size; i++)
	{
		array[i] = size - i;
	}
	
	cout << calc_sum1(array, sizeof(array) / sizeof(int)) << endl;
	cout << calc_sum2(array, array + size) << endl;
	cout << calc_sum3(array) << endl;

	return 0;
}
